<style>
    /* 选项卡样式 */
    .nav-tabs {
        border-bottom: 1px solid #ddd;
        margin-bottom: 20px;
    }

    .nav-tabs>li {
        float: left;
        margin-bottom: -1px;
    }

    .nav-tabs>li>a {
        margin-right: 2px;
        line-height: 1.42857143;
        border: 1px solid transparent;
        border-radius: 4px 4px 0 0;
        padding: 10px 15px;
    }

    .nav-tabs>li>a:hover {
        border-color: #eee #eee #ddd;
    }

    .nav-tabs>li.active>a,
    .nav-tabs>li.active>a:hover,
    .nav-tabs>li.active>a:focus {
        color: #555;
        cursor: default;
        background-color: #fff;
        border: 1px solid #ddd;
        border-bottom-color: transparent;
    }

    .tab-content {
        padding: 20px;
        border: 1px solid #ddd;
        border-top: none;
        background-color: #fff;
        margin-top: 10px;
    }

    /* 地图容器样式 */
    #map-container {
        width: 100%;
        border: 1px solid #ddd;
        border-radius: 4px;
    }

    /* 开关按钮基础样式 */
    .btn-switcher {
        display: inline-block;
        cursor: pointer;
        transition: all 0.3s ease;
        text-decoration: none;
    }

    /* 激活状态（开启） */
    .btn-switcher.active i {
        color: #1ab394;
        /* 成功绿色 */
        transform: scale(1.1);
    }

    /* 非激活状态（关闭） */
    .btn-switcher:not(.active) i {
        color: #ddd;
        /* 灰色 */
        transition: all 0.3s ease;
    }

    /* 悬停效果 */
    .btn-switcher:hover {
        opacity: 0.8;
    }

    /* 状态文本样式 */
    [data-favisible^="switch="] {
        display: inline-block;
        margin-left: 8px;
        font-size: 12px;
        transition: opacity 0.3s;
    }

    /* 隐藏未激活的状态文本 */
    [data-favisible="switch=0"][style*="display: none"],
    [data-favisible="switch=1"][style*="display: none"] {
        opacity: 0;
    }

    /* 图标翻转效果（关闭状态） */
    .btn-switcher i.fa-flip-horizontal {
        transform: rotateY(180deg);
    }

    /* 列表页中的开关按钮调整 */
    .table .btn-switcher {
        margin: 0 5px;
    }
</style>
<form id="add-form" class="form-horizontal" style="position:relative;background: #fff" role="form"
    data-toggle="validator" method="POST" action="">
    <!-- 添加jQuery引用 -->
    <script src="/assets/js/jquery-3.7.1.min.js"></script>
    <script type="text/javascript"
        src="https://api.map.baidu.com/api?v=3.0&ak=HX3XrjGHigjidfWYSf6bozZbiABeWfUX"></script>
    <!--script type="text/javascript" src="/assets/js/backend/common/api?v=3.0&ak=HX3XrjGHigjidfWYSf6bozZbiABeWfUX"></script-->
    <script type="text/javascript" src="/assets/js/backend/common/DrawingManager_min.js"></script>
    <!-- 百度地图证书错误修复脚本 -->
    <script type="text/javascript" src="/assets/js/backend/common/baidu-map-fix.js"></script>

    <style>
        #map {
            width: 100%;
            height: 500px;
        }

        .form-control {
            margin-bottom: 10px;
        }

        .button {
            margin-top: 10px;
            padding: 5px 10px;
            background-color: #007BFF;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }

        .coordinates {
            margin-top: 10px;
        }
    </style>
    <div class="panel panel-default">
        <div class="panel-heading">
            <ul class="nav nav-tabs">
                <li class="active"><a href="#tabs_0" data-toggle="tab" aria-expanded="true">基础信息</a></li>
                <li><a href="#tabs_1" data-toggle="tab" id="classroomdiv" aria-expanded="true"
                        style="display: block">教室作息设置</a></li>
                <li><a href="#tabs_2" data-toggle="tab" id="sliderdiv" aria-expanded="true"
                        style="display: block">轮播图设置</a></li>
            </ul>
        </div>
        <div class="panel-body"></div>
        <div id="myTabContent" class="tab-content" style="border-top: 1px solid #ccc;margin-top:7px">
            <div class="tab-pane fade active in" id="tabs_0">
                <input type="hidden" name="row[id]" value="" class="form-control" data-rule="" data-tip="ID" />

                <div class="form-group">
                    <label for="c-name" class="control-label col-xs-12 col-sm-2">教学点名称:</label>
                    <div class="col-xs-12 col-sm-8" id="div-name">
                        <input type="text" id="c-name" name="row[name]" value="" class="form-control" title="name"
                            placeholder="" data-rule="" data-tip="教学点名称" />
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-alias" class="control-label col-xs-12 col-sm-2">别名:</label>
                    <div class="col-xs-12 col-sm-8" id="div-alias">
                        <input type="text" id="c-alias" name="row[alias]" value="" class="form-control" title="alias"
                            placeholder="" data-rule="" data-tip="教学点别名" />
                    </div>
                </div>
                {if $admin['group_id']==3}
                <input type="hidden" id="h-rel_type" name="row[rel_type]" value="1">
                <input type="hidden" id="h-rel_id" name="row[rel_id]" value="{$admin['school_id']}">

                {elseif $admin['group_id']==8}
                <input type="hidden" id="h-rel_type" name="row[rel_type]" value="2">
                <input type="hidden" id="h-rel_id" name="row[rel_id]" value="{$admin['community_id']}">
                {else}
                <div class="form-group">
                    <label for="c-rel_type" class="control-label col-xs-12 col-sm-2">主体类型:</label>
                    <div class="col-xs-12 col-sm-8" id="div-rel_type">
                        <select name="row[rel_type]" id="c-rel_type" class="form-control selectpicker" data-rule=""
                            data-tip="主体类型">
                            <option value="1">学校</option>
                            <option value="2">社区</option>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label for="c-rel_id" class="control-label col-xs-12 col-sm-2">主体:</label>
                    <div class="col-xs-12 col-sm-8" id="div-rel_id">
                        <select name="row[rel_id]" id="c-rel_id" class="form-control" data-tip="主体">
                        </select>
                    </div>
                </div>
                {/if}
                {if $admin['group_id']==3 || $admin['group_id']==8 || $admin['group_id']==1 || $admin['group_id']==2}
                <div class="form-group">
                    <label for="c-ocation_pid" class="control-label col-xs-12 col-sm-2">父级:</label>
                    <div class="col-xs-12 col-sm-8" id="div-pid">
                        <select name="row[pid]" id="c-ocation_pid" class="form-control" data-tip="父级教学点标签">
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-address_lv_octionlevel" class="control-label col-xs-12 col-sm-2">教学点等级:</label>
                    <div class="col-xs-12 col-sm-8" id="div-cation_level_type">
                        <select name="row[address_lv_octionlevel]" id="c-address_lv_octionlevel" class="form-control"
                            data-tip="教学点等级">
                            <option value="0" selected>标签</option>
                            <option value="1">一级教学点</option>
                            <option value="2">二级教学点</option>
                            <option value="3" style="display:none">三级教学点</option>
                            <option value="4">上课教室</option>
                        </select>
                    </div>
                </div>

                <!-- 校内校外字段，只在教学点等级为3或4时显示 -->
                <div class="form-group" id="school_location_type_group" style="display: none;">
                    <label class="control-label col-xs-12 col-sm-2">校内校外:</label>
                    <div class="col-xs-12 col-sm-8" id="div-school_location_type">
                        <label for="row[school_location_type]-1">
                            <input id="row[school_location_type]-1" name="row[school_location_type][]" type="checkbox"
                                value="1" data-tip="校内校外" /> 校内
                        </label>
                        <label for="row[school_location_type]-2">
                            <input id="row[school_location_type]-2" name="row[school_location_type][]" type="checkbox"
                                value="2" data-tip="校内校外" /> 校外
                        </label>
                    </div>
                </div>
                {else}
                <input type="hidden" id="h-address_lv" name="row[address_lv]" value="0">
                {/if}
                {if $admin["group_id"]==1||$admin["group_id"]==2||$admin["group_id"]==3||$admin["group_id"]==8}
                <div class="form-group">
                    <label for="c-starttime" class="control-label col-xs-12 col-sm-2">使用期限开始:</label>
                    <div class="col-xs-12 col-sm-8" id="div-starttime">
                        <div class="form-inline">
                            <input type="text" id="c-starttime" name="row[starttime]"
                                value="<?php echo date('Y-m-d');?>" class="form-control datetimepicker"
                                data-date-format="YYYY-MM-DD" data-tip="使用期限开始" data-rule="" />
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label for="c-endtime" class="control-label col-xs-12 col-sm-2">使用期限结束:</label>
                    <div class="col-xs-12 col-sm-8" id="div-endtime">
                        <div class="form-inline">
                            <input type="text" id="c-endtime" name="row[endtime]" value="<?php echo date('Y-m-d');?>"
                                class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-tip="使用期限结束"
                                data-rule="" />
                        </div>
                    </div>
                </div>
                {/if}
                <div class="form-group" id="entvirt-group" style="display: none;">
                    <label class="control-label col-xs-12 col-sm-2">实体或虚拟:</label>
                    <div class="col-xs-12 col-sm-8" id="div-entvirt">
                        <label for="row[entvirt]-1"><input id="row[entvirt]-1" name="row[entvirt]" type="radio"
                                value="1" data-tip="实体或虚拟" checked /> 实体</label>
                        <label for="row[entvirt]-2"><input id="row[entvirt]-2" name="row[entvirt]" type="radio"
                                value="2" data-tip="实体或虚拟" /> 虚拟</label>
                    </div>
                </div>
                <div class="form-group" style="display: none;">
                    <label class="control-label col-xs-12 col-sm-2">教室类型:</label>
                    <div class="col-xs-12 col-sm-8" id="div-ocation_type">
                        <label for="row[ocation_type]-1"><input id="row[ocation_type]-1" name="row[ocation_type]"
                                type="radio" value="1" checked /> 标准(有桌椅)</label>
                        <label for="row[ocation_type]-2"><input id="row[ocation_type]-2" name="row[ocation_type]"
                                type="radio" value="2" /> 书画(有书画桌)</label>
                        <label for="row[ocation_type]-3"><input id="row[ocation_type]-3" name="row[ocation_type]"
                                type="radio" value="3" /> 肢体(开阔的场地)</label>
                        <label for="row[ocation_type]-4"><input id="row[ocation_type]-4" name="row[ocation_type]"
                                type="radio" value="4" /> 综合(有椅没桌)</label>
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-cityarea_id" class="control-label col-xs-12 col-sm-2">行政区划:</label>
                    <div class="col-xs-12 col-sm-8" id="div-cityarea_id">
                        <div style="margin-top:-2px;margin-left: -2px;">
                            <select id="c-cityarea_id" id="province" id="province_id" class="form-control liandong"
                                name="row[province_id]" type="text" value="">

                            </select>
                            <select id="city" class="form-control liandong" name="row[city_id]" type="text" value="">

                            </select>
                            <select id="county" class="form-control liandong" name="row[district_id]" type="text"
                                value="">

                            </select>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label for="c-longitude" class="control-label col-xs-12 col-sm-2">经纬度定位:</label>
                    <div class="col-xs-12 col-sm-8" id="div-longitude">
                        <div id="map" style="height: 300px;"></div>
                        经度：<input type="text" id="c-longitude" name="row[longitude]" value="" class="form-control"
                            placeholder="经度" data-rule="" />
                        纬度：<input type="text" id="c-latitude" name="row[latitude]" value="" class="form-control"
                            placeholder="纬度" data-rule="" />
                    </div>
                </div>

                <div class="form-group">
                    <label for="c-address" class="control-label col-xs-12 col-sm-2">描述:</label>
                    <div class="col-xs-12 col-sm-8" id="div-address">
                        <input type="text" id="c-address" name="row[address]" value="" class="form-control"
                            title="address" placeholder="" data-rule="" data-tip="地址" />
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-intro" class="control-label col-xs-12 col-sm-2">教学点详情:</label>
                    <div class="col-xs-12 col-sm-8" id="div-intro">
                        <!-- AI智能生成教学点详情按钮 -->
                        <div style="margin-bottom: 10px;">
                            <button type="button" id="ai-generate-intro" class="btn btn-info btn-sm ai-generate-intro"
                                data-input-id="c-intro">
                                <i class="fa fa-magic"></i> AI智能生成教学点详情
                            </button>
                            <span class="text-muted" style="margin-left: 10px;">基于教学点信息智能生成详情介绍（500字以内）</span>
                        </div>
                        <textarea name="row[intro]" id="c-intro" class="form-control editor" data-rule="" rows="5"
                            data-tip="学校简介"></textarea>
                    </div>
                </div>

                <div class="form-group">
                    <label for="c-cover" class="control-label col-xs-12 col-sm-2">教学点封面:</label>
                    <div class="col-xs-12 col-sm-8" id="div-cover">
                        <div class="form-inline">
                            <input id="c-cover" class="form-control" size="38" name="row[cover]" type="text" value=""
                                data-tip="">
                            <span><button type="button" id="plupload-cover" class="btn btn-danger plupload"
                                    data-input-id="c-cover" data-mimetype="image/*" data-multiple="false"
                                    data-preview-id="p-cover" data-width="114" data-height="114"><i
                                        class="fa fa-upload"></i>
                                    {:__('Upload')}</button></span>
                            <span><button type="button" id="ai-generate-cover" class="btn btn-success ai-generate-image"
                                    data-type="ai-generate-cover" data-input-id="c-cover" data-width="114"
                                    data-height="114" data-say="为这个教学点生成一张有创意的封面图片，风格现代简洁，色彩温暖,尺寸：114*114"><i
                                        class="fa fa-magic"></i> AI自动</button></span>
                            <span class="text-muted">建议尺寸：114*114</span>
                            <ul class="row list-inline plupload-preview" id="p-cover"></ul>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label for="c-header_image" class="control-label col-xs-12 col-sm-2">教学头图片:</label>
                    <div class="col-xs-12 col-sm-8" id="div-header_image">
                        <div class="form-inline">
                            <input id="c-header_image" class="form-control" size="38" name="row[header_image]"
                                type="text" value="" data-tip="">
                            <span><button type="button" id="plupload-header_image" class="btn btn-danger plupload"
                                    data-input-id="c-header_image" data-mimetype="image/*" data-multiple="false"
                                    data-preview-id="p-header_image" data-width="750" data-height="422"><i
                                        class="fa fa-upload"></i>
                                    {:__('Upload')}</button></span>
                            <span><button type="button" id="ai-generate-image" class="btn btn-success ai-generate-image"
                                    data-type="ai-generate-header_image" data-input-id="c-header_image" data-width="750"
                                    data-height="422" data-say="为这个教学点生成一张有创意的头部图片,尺寸：750*422，风格现代简洁，色彩温暖"><i
                                        class="fa fa-magic"></i> AI自动</button></span>
                            <span class="text-muted">建议尺寸：750*422</span>
                            <ul class="row list-inline plupload-preview" id="p-header_image"></ul>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label for="c-status" class="control-label col-xs-12 col-sm-2">状态:</label>
                    <div class="col-xs-12 col-sm-8" id="div-status">
                        <input id="c-status" name="row[status]" type="hidden" value="1">
                        <a href="javascript:;" data-toggle="switcher" class="btn-switcher active"
                            data-input-id="c-status" data-yes="1" data-no="0">
                            <i class="fa fa-toggle-on text-success fa-2x"></i>
                        </a>
                        <div data-favisible="switch=1" class="p-3">已开启</div>
                    </div>
                </div>
            </div>
            <div class="tab-pane fade in" id="tabs_1">
                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">时段选择:</label>
                    <div class="col-xs-12 col-sm-8" id="div-daytime">
                        <label for="row[daytime]-1"><input id="row[daytime]-1" name="row[daytime][]" type="checkbox"
                                value="1" checked /> 上午</label>
                        <label for="row[daytime]-2"><input id="row[daytime]-2" name="row[daytime][]" type="checkbox"
                                value="2" /> 中午</label>
                        <label for="row[daytime]-3"><input id="row[daytime]-3" name="row[daytime][]" type="checkbox"
                                value="3" checked /> 下午</label>
                        <label for="row[daytime]-4"><input id="row[daytime]-4" name="row[daytime][]" type="checkbox"
                                value="4" /> 晚上</label>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">课节时长:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input type="text" id="c-classtime" name="row[classtime]" value="90" class="form-control"
                            title="classtime" placeholder="请输入一堂课的时间" data-rule="" data-tip="一堂课的时间" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">课间休息时间:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input type="text" id="c-classsleeptime" name="row[classsleeptime]" value="15"
                            class="form-control" title="classsleeptime" placeholder="请输入课间的休息时间" data-rule=""
                            data-tip="请输入课间的休息时间" />
                    </div>
                </div>


                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">排时段:</label>
                    <div class="col-xs-12 col-sm-8">
                        <div id="schedule-table-container" style="margin-top: 20px;">
                            <!-- 表格将动态生成在这里 -->
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">周最大课数<br>(最大：<span id="maxks"></span>):</label>
                    <div class="col-xs-12 col-sm-8">
                        <input type="number" id="c-classes-per-week" name="row[classes_per_week]" value="20"
                            class="form-control" title="classes_per_week" placeholder="请输入一周的最大排课数" data-rule=""
                            data-tip="一周最大排课数" />
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">周几上课:</label>
                    <div class="col-xs-12 col-sm-8">
                        <label for="weekdays-1"><input id="weekdays-1" name="row[weekdays][]" type="checkbox"
                                value="1" /> 周一</label>
                        <label for="weekdays-2"><input id="weekdays-2" name="row[weekdays][]" type="checkbox"
                                value="2" /> 周二</label>
                        <label for="weekdays-3"><input id="weekdays-3" name="row[weekdays][]" type="checkbox"
                                value="3" /> 周三</label>
                        <label for="weekdays-4"><input id="weekdays-4" name="row[weekdays][]" type="checkbox"
                                value="4" /> 周四</label>
                        <label for="weekdays-5"><input id="weekdays-5" name="row[weekdays][]" type="checkbox"
                                value="5" /> 周五</label>
                        <label for="weekdays-6"><input id="weekdays-6" name="row[weekdays][]" type="checkbox"
                                value="6" /> 周六</label>
                        <label for="weekdays-7"><input id="weekdays-7" name="row[weekdays][]" type="checkbox"
                                value="7" /> 周日</label>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">禁用周段:</label>
                    <div class="col-xs-12 col-sm-8">
                        <select type="text" id="DisableWeekRange" name="row[disable_week_range][]" multiple
                            class="form-control selects" placeholder="点击选择日期" data-rule="" data-tip="哪天禁排课"></select>
                        <div class="help-block text-info">提示：按住Ctrl键可多选目标</div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">禁用时点:</label>
                    <div class="col-xs-12 col-sm-8">
                        <select type="text" id="DisableWeekTime" name="row[disable_week_time][]" multiple
                            class="form-control selects" placeholder="点击选择日期" data-rule="" data-tip="哪天禁排课"></select>
                        <div class="help-block text-info">提示：按住Ctrl键可多选目标</div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">容纳人数:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input type="number" id="maxnumber" name="row[max_number]" multiple value=""
                            class="form-control" placeholder="单教室每周最大排课数量" data-rule="" data-tip="单教室每周最大排课数量"></input>
                    </div>
                </div>
                <div class="form-group layer-footer">
                    <label class="control-label col-xs-12 col-sm-2"></label>
                    <div class="col-xs-12 col-sm-8">
                        <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
                        <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
                    </div>
                </div>
            </div>
            <div class="tab-pane fade in" id="tabs_2">
                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">轮播图管理:</label>
                    <div class="col-xs-12 col-sm-8">
                        <button type="button" class="btn btn-primary" id="manage-slider-btn">
                            <i class="fa fa-image"></i> 管理轮播图
                        </button>
                        <div class="help-block">点击按钮管理当前教学点的首页轮播图</div>
                    </div>
                </div>
            </div>
        </div>
        <script src="/assets/js/ai-helper.js"></script>
    </div>
    </div>
</form>